
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="page/head.jsp"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <form method="post" action="/emp?method=addEmp">
                    <div class="form-group">
                        <label for="exampleInputEmail1">员工名</label>
                        <input type="text" class="form-control" name="ename" id="exampleInputEmail1" placeholder="ename">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">密码</label>
                        <input type="password" class="form-control" name="pwd" id="exampleInputPassword1" placeholder="Password">
                    </div>
                    <div class="form-group">
                        <label>性别</label>
                        <label class="radio-inline">
                            <input type="radio" name="esex" id="inlineRadio1" value="男" checked> 男
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="esex" id="inlineRadio2" value="女"> 女
                        </label>
                    </div>
                    <div class="form-group">
                        <label for="salary">工资</label>
                        <input type="number" class="form-control" name="salary" id="salary" placeholder="salary">
                    </div>
                    <div class="form-group">
                        <label for="salary">部门</label>
                        <select class="form-control" name="dno" id="dno">
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="bornDate">出生日期</label>
                        <input type="date" class="form-control" name="born_date" id="bornDate" >
                    </div>
                    <button type="submit" class="btn btn-default">新增</button>
                </form>
            </div>
        </div>
    </div>
<script>
    $(function () {
            $.ajax({
                url:"/dept?method=getAll",
                type:"get",
                dataType:"json",
                success:function (result) {
                    for (let x in result) {
                        $("#dno").append("<option value='"+result[x].dno+"'>"+result[x].dname+"</option>");
                    }
                }
            })
    })
</script>
</body>
</html>
